package com.ctl.utils.jsonserializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

public class CharArraySerializer extends JsonSerializer<char[]> {
    @Override
    public void serialize(char[] value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeStartArray();
        for (char c : value) {
            gen.writeString(Character.toString(c));
        }
        gen.writeEndArray();
    }
}